package com.vae.learn.feignclient;


import com.vae.base.model.video.RestResponse;
import com.vae.learn.feignclient.MediaServiceClient;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class MediaServiceClientFallbackFactory implements FallbackFactory<MediaServiceClient> {
    @Override
    public MediaServiceClient create(Throwable throwable) {
        return new MediaServiceClient() {
            @Override
            public RestResponse<String> getPlayUrlByMediaId(String mediaId) {
                System.out.println("远程调用媒资管理服务熔断异常: "+ throwable.getMessage());
                return null;
            }
        };
    }
}